﻿@model Zor_Web.Models.Base.V_Zor_PayTaxes
@using Webdiyer.WebControls.Mvc;
@using Zor_Tools;
@{
    Layout = null;
}
<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>缴税管理</title>
    <link href="~/Content/LayerUI/src/css/layui.css" rel="stylesheet" />
    <link href="~/Content/bootstrap/css/bootstrap.min.css" rel="stylesheet" />
    <link href="~/Content/Styles/zor.css" rel="stylesheet" />
    <!-- 框架必要 -->
    <script src="~/Content/Scripts/jquery/jquery-1.9.1.min.js"></script>
    <script src="~/Content/Scripts/learunui-framework.js"></script>
    <script src="~/Content/Scripts/Zor_AJax.js"></script>
    <!-- 消息提示 -->
    <script language='javascript' src='~/Content/layer/layer.js'></script>
    <!-- 日期选择器 -->
    <script src="~/Content/laydate/laydate.js"></script>
    <!-- 表单验证 -->
    <script src="~/Content/Scripts/JValidator.js"></script>
    <!-- 税种 -->
    <script src="~/Content/Scripts/RatMoney.js"></script>
    <!-- 弹出层 -->
    <script src="~/Content/layer/layer.js"></script>

    <!-- 打印单样式 -->
    <style type="text/css">
        .p5 {
            /*font-size: 12px;*/
            font: 12px '新宋体';
        }

        #TenantType {
            position: absolute;
            top: 55px;
            left: 50px;
        }

        #Now_Year {
            position: absolute;
            top: 55px;
            left: 253px;
        }

        #Now_Month {
            position: absolute;
            top: 55px;
            left: 303px;
        }

        #Now_Day {
            position: absolute;
            top: 55px;
            left: 343px;
        }

        #Dt_Name {
            position: absolute;
            top: 55px;
            left: 500px;
        }

        #NatPer_IDNumber1 {
            position: absolute;
            top: 77px;
            left: 38px;
        }

        /*#Acceptance_TaxNumber1 {
            position: absolute;
            top: 77px;
            left: 38px;
        }*/

        #NatPer_Name {
            position: absolute;
            top: 77px;
            left: 390px;
        }


        #Acceptance_Address1 {
            position: absolute;
            top: 102px;
            left: 38px;
        }

        #taxCate {
            position: absolute;
            top: 180px;
            left: 2px;
        }

        #itemsName {
            position: absolute;
            top: 180px;
            left: 75px;
        }

        #ETotalTax1 {
            position: absolute;
            top: 180px;
            left: 275px;
        }

        #taxRate {
            position: absolute;
            top: 180px;
            left: 355px;
        }

        #lastMonthStart {
            position: absolute;
            top: 180px;
            left: 415px;
        }

        #arrive_s {
            position: absolute;
            top: 180px;
            left: 480px;
        }

        #lastMonthEnd {
            position: absolute;
            top: 180px;
            left: 495px;
        }

        #EPropertyTax {
            position: absolute;
            top: 180px;
            left: 630px;
        }

        #taxCate_g {
            position: absolute;
            top: 205px;
            left: 2px;
        }

        #itemsName_g {
            position: absolute;
            top: 205px;
            left: 75px;
        }

        #ETotalTax2 {
            position: absolute;
            top: 205px;
            left: 275px;
        }


        #taxRate_g {
            position: absolute;
            top: 205px;
            left: 355px;
        }

        #lastMonthStart2 {
            position: absolute;
            top: 205px;
            left: 415px;
        }

        #arrive {
            position: absolute;
            top: 205px;
            left: 480px;
        }

        #lastMonthEnd2 {
            position: absolute;
            top: 205px;
            left: 495px;
        }

        #EPersonalTax {
            position: absolute;
            top: 205px;
            left: 630px;
        }

        #PtActualTax3 {
            position: absolute;
            top: 350px;
            left: 75px;
        }

        #User_RealName1 {
            position: absolute;
            top: 430px;
            left: 230px;
        }

        #Pt_CertificateNumber1 {
            position: absolute;
            top: 390px;
            left: 390px;
        }

        .Pt_Cer {
            /*font-size: 12px;*/
            font: 25px '微软雅黑';
            color: #FF5722;
        }
    </style>

</head>
<body class="gray-bg">
    <!-- 打印模态 -->
    <div hidden class="content">
        <div id="modalPrint">
            <p class="p5">
                <label id="TenantType"></label>
                <label id="Now_Year"></label>
                <label id="Now_Month"></label>
                <label id="Now_Day"></label>
                <label id="Dt_Name"></label>
            </p>
            <p class="p5">
                <label id="NatPer_IDNumber1"></label>
                @*<label id="Acceptance_TaxNumber1"></label>*@
                <label id="NatPer_Name"></label>
            </p>
            <p class="p5">
                <label id="Acceptance_Address1"></label>
            </p>
            <p class="p5">
                <label id="taxCate"></label>
                <label id="itemsName"></label>
                <label id="ETotalTax1"></label>
                <label id="taxRate"></label>
                <label id="lastMonthStart"></label>
                <label id="arrive_s"></label>
                <label id="lastMonthEnd"></label>
                <label id="EPropertyTax"></label>
            </p>
            <p class="p5">
                <label id="taxCate_g"></label>
                <label id="itemsName_g"></label>
                <label id="ETotalTax2"></label>
                <label id="taxRate_g"></label>
                <label id="lastMonthStart2"></label>
                <label id="arrive"></label>
                <label id="lastMonthEnd2"></label>
                <label id="EPersonalTax"></label>
            </p>
            <p class="p5">
                <label id="PtActualTax3"></label>
            </p>
            <p class="p5">
                <label id="User_RealName1"></label>
                <label id="Pt_CertificateNumber1"></label>
            </p>
        </div>
    </div>
    <div class="layui-tab layui-tab-brief main-tab-container ">

        <div class="col-sm-12 ct-padding">
            <div class="col-sm-8 ct-padding">
                <button id="btnPayTaxes" class="layui-btn layui-btn-gold layui-btn-small"><span class="glyphicon glyphicon-yen"></span> 缴税</button>
                <button id="btnPrint" class="layui-btn  layui-btn-steelblue layui-btn-small"><span class="glyphicon glyphicon-print"></span>打印</button>
                <button id="btnSearchFull" class="layui-btn  layui-btn-normal layui-btn-small"><span class="glyphicon glyphicon-search"></span>查询</button>
                <button id="btnMessage" class="layui-btn layui-btn-orchid  layui-btn-small"><span class="glyphicon glyphicon-list-alt"></span>详情</button>
                <button id="btnRefresh" class="layui-btn layui-btn-blue layui-btn-small"><span class="glyphicon glyphicon-repeat"></span>刷新</button>
            </div>
        </div>
    </div>

    <div class="col-sm-12  layui-tab-content">
        <div class="mail-box" style="overflow-x:scroll;white-space:nowrap;">
            <table class="layui-table" lay-skin="line">
                <thead>
                    <tr>
                        <th hidden></th>
                        <th></th>
                        <th>受理单号</th>
                        <th>付款人</th>
                        <th>纳税人</th>
                        <th>联系方式</th>
                        <th>面积</th>
                        <th>租金</th>
                        <th>完税证号</th>
                        <th>税金</th>
                        <th>缴税时间</th>
                        <th>开票人</th>
                        <th>受理状态</th>
                    </tr>
                </thead>
                <tbody id="accordion">
                    @foreach (var item in Model.PageData)
                {
                        <tr>

                            <td hidden>@item.Pt_Id</td>
                            <td><input type="radio" name="chk" id="@item.Pt_Id" value="@item.Pt_Id" /></td>
                            <td>@item.Acceptance_TicketNumber</td>
                            <td>@item.Tenant_Name</td>     <!--3  -->
                            <td>@item.NatPer_Name</td>
                            <td>@item.NatPer_Phone</td>
                            <td>@item.Hs_Proportion</td>
                            <td>@(item.EReviewRent * 0.01)</td><!-- 7评定租金 -->
                            <td>@item.Pt_CertificateNumber</td><!-- 8完税证号 -->
                            <td>@(item.ETax * 0.01)</td>
                            @if (@item.Pt_Date != null)
                        {
                                <td>@TimeHelper.TimeStampToDateTime(item.Pt_Date.ToString(), TimeHelper.ToTimeType.link_ymd)</td>}
                        else
                        {
                                <td>未缴税</td> }
                            <td>@item.User_RealName</td> <!-- 11开票人 -->
                            @if (@item.PtState == "未缴税")
                        {

                                <td><span class='label label-warning pull-center'>@item.PtState</span></td>
                        }
                        else
                        {
                                <td>@item.PtState</td>
                        }

                            <td hidden>@item.Acceptance_Id</td>
                            <td hidden>@item.CommunityName</td>
                            <td hidden>@item.NatPer_IDNumber</td>
                            <td hidden>@item.Acceptance_TaxNumber</td><!--16 税号 -->
                            <td hidden>@(item.ReviewRent * 0.01)</td><!-- 17评议租金 -->
                            <td hidden>@item.Csqx</td><!-- 18产权属性 -->
                            <td hidden>@item.AHA</td><!-- 19房屋属性 -->
                            <td hidden>@item.Acceptance_Address</td> <!-- 20地址 -->
                            <td hidden>@TimeHelper.TimeStampToDateTime(item.Review_Date.ToString(), TimeHelper.ToTimeType.link_ymd)</td>
                            <td hidden>@TimeHelper.TimeStampToDateTime(item.Lease_StartTime.ToString(), TimeHelper.ToTimeType.link_ymd)</td><!--22 租赁开始时间 -->
                            <td hidden>@TimeHelper.TimeStampToDateTime(item.Lease_EndTime.ToString(), TimeHelper.ToTimeType.link_ymd)</td><!--23 租赁结束时间 -->
                            <td hidden>@TimeHelper.TimeStampToDateTime(item.Acceptance_TaxStartTime.ToString(), TimeHelper.ToTimeType.link_ymd)</td><!--24 税收开始时间 -->
                            <td hidden>@TimeHelper.TimeStampToDateTime(item.Acceptance_TaxEndTime.ToString(), TimeHelper.ToTimeType.link_ymd)</td>  <!-- 25税收结束时间 -->
                            <td hidden>@item.Hs_attribute</td><!--26 房屋属性 -->
                            <td hidden>@item.Hs_Cqsx</td>  <!--27 产权属性 -->
                            <td hidden>@(item.leaseRent * 0.01)</td>
                            <td hidden>@(item.EPropertyTax * 0.01)</td><!-- 29评定房税 -->
                            <td hidden>@(item.EPersonalTax * 0.01)</td><!-- 30评定个税 -->
                            <td hidden>@(item.ETotalTax * 0.01)</td><!-- 31评定计税总额 -->
                            <td hidden>@item.Review_Comment</td>
                            <td hidden>@item.ReviewUser</td>
                            <td hidden>@TimeHelper.TimeStampToDateTime(item.Evaluate_Date.ToString(), TimeHelper.ToTimeType.link_ymd)</td>
                            <td hidden>@item.Evaluate_Comment</td>
                            <td hidden>@item.Examine_Comment</td>
                            <td hidden>@item.EvaluateUser</td>
                            <td hidden>@TimeHelper.TimeStampToDateTime(item.Examine_Date.ToString(), TimeHelper.ToTimeType.link_ymd)</td>
                            <td hidden>@item.ExamineUser</td>
                            <td hidden>@(item.PtActualTax * 0.01)</td> <!-- 40实缴税金 -->
                            <td hidden>@item.Now_Year</td><!-- 41当前时间-年 -->
                            <td hidden>@item.Pt_State</td>
                            <td hidden>@item.lastMonthStart</td>
                            <td hidden>@item.lastMonthEnd</td>
                            <td hidden>@item.Tenant_Type</td><!--45 租户类别 1个人 2企业 -->
                            <td hidden>@item.TenantType</td><!--46 租户类别 1个人 2企业 -->
                            <td hidden>@item.Now_Month</td><!-- 47当前时间-月 -->
                            <td hidden>@item.Now_Day</td><!-- 48当前时间-日 -->

                        </tr>
                }
                </tbody>
            </table>
            <div class="col-sm-12">
                <div class="col-sm-10">
                    @Html.Pager(Model.PageData, new PagerOptions { PageIndexParameterName = "index", ContainerTagName = "ul", PrevPageText = "上页", NextPageText = "下页", FirstPageText = "首页", LastPageText = "尾页", CssClass = "pagination", PagerItemsSeperator = "", CurrentPagerItemWrapperFormatString = "<li class=\"active\"><a href=\"#\">{0}</a></li>", PagerItemWrapperFormatString = "<li>{0}</li>" }, new { id = "bootstrappager", @class = "pagination" })
                </div>
                <div class="col-sm-2    to-righjt">
                    共 @Model.PageData.TotalItemCount 条记录，页 @Model.PageData.CurrentPageIndex/@Model.PageData.TotalPageCount
                </div>
            </div>
        </div>
    </div>
        @using (Html.BeginForm("Zor_PayTaxes", "Base", new RouteValueDictionary { { "Model", Model } }, FormMethod.Get))
        {
    <!-- 查询模态框 -->
            <div id="myModalSearch" hidden data-backdrop="static">
                <div id="divfrom" class="layui-tab-content">
                    <form method="get" class="form-horizontal m-t">
                        <div class="layui-form-item">
                            <label class="col-sm-2    layui-form-label">缴税起始日：</label>
                            <div class="col-sm-4">
                                <input id="Search_StartTime" name="Lease_StartTime" type="text" class="laydate-icon  form-control layer-date" value="@Model.Lease_StartTime">
                            </div>
                            <label class="col-sm-2    layui-form-label">缴税终止日：</label>
                            <div class="col-sm-4">
                                <input id="Search_EndTime" name="Lease_EndTime" type="text" class="laydate-icon form-control layer-date" value="@Model.Lease_EndTime">
                            </div>

                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="layui-form-item">
                            <label class="col-sm-2    layui-form-label">业主姓名：</label>
                            <div class="col-sm-4">
                                <input name="NatPer_Name" type="text" class="form-control" value="@Model.NatPer_Name">
                            </div>
                            <label class="col-sm-2    layui-form-label">业主联系电话：</label>
                            <div class="col-sm-4">
                                <input name="NatPer_Phone" type="text" class="form-control" value="@Model.NatPer_Phone">
                            </div>
                        </div>

                        <div class="hr-line-dashed"></div>
                        <div class="layui-form-item">
                            <label class="col-sm-2    layui-form-label f12">业主身份证号：</label>
                            <div class="col-sm-4">
                                <input name="NatPer_IDNumber" type="text" class="form-control" value="@Model.NatPer_IDNumber">
                            </div>
                            <label class="col-sm-2    layui-form-label">税号：</label>
                            <div class="col-sm-4">
                                <input name="Acceptance_TaxNumber" type="text" class="form-control" value="@Model.Acceptance_TaxNumber">
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="layui-form-item">
                            <label class="col-sm-2    layui-form-label">付款人/单位：</label>
                            <div class="col-sm-4">
                                <input name="Tenant_Name" type="text" class="form-control" value="@Model.Tenant_Name">
                            </div>
                            <label class="col-sm-2    layui-form-label">受理单号：</label>
                            <div class="col-sm-4">
                                <input type="text" class="form-control" name="Acceptance_TicketNumber" value="@Model.Acceptance_TicketNumber">
                            </div>
                        </div>
                        <div class="layui-form-item">

                            <label class="col-sm-2    layui-form-label">受理单状态：</label>
                            <div class="col-sm-4">
                                <select name="PtState" class="form-control">
                                    <option value="全部">全部</option>
                                    <option value="@Model.PtState">未缴税</option>
                                    <option value="@Model.PtState">已缴税</option>
                                    <option value="@Model.PtState">已打印</option>
                                </select>
                            </div>
                            <label class="col-sm-2    layui-form-label">发起类型：</label>
                            <div class="col-sm-4">
                                <select name="AcceptanceType" class="form-control">
                                    <option value="全部">全部</option>
                                    <option value="@Model.AcceptanceType">社区</option>
                                    <option value="@Model.AcceptanceType">自然人</option>
                                </select>
                            </div>
                        </div>

                    </form>
                    <div class="box-footer">
                        <button type="submit" class="layui-btn layui-btn-normal layui-btn-small pull-right">
                            <i class="fa fa-search"></i>查询
                        </button>
                    </div>
                </div>
            </div>

        }
        <!-- 详情模态 -->
        <div id="myModalDetails" hidden data-backdrop="static">
            <div id="divfrom" class="layui-tab-content">
                <form method="get" class="form-horizontal m-t">
                    <div class="layui-form-item" hidden>
                        <label class="col-sm-3layui-form-label">Id：</label>
                        <div class="col-sm-9">
                            <input id="Evaluate_Id" type="text" class="form-control">
                            <input id="Acceptance_Id" type="text" class="form-control">
                            <input id="Evaluate_State" type="text" class="form-control">
                            <input id="Examine_Id" type="text" class="form-control">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="col-sm-2  layui-form-label">地址：</label>
                        <div class="col-sm-10 layui-input" id="Acceptance_Address"></div>
                    </div>

                    <div class="layui-form-item">
                        <label class="col-sm-2  layui-form-label">业主姓名：</label>
                        <div class="col-sm-4 layui-input" id="NatPerName"></div>
                        <label class="col-sm-2  layui-form-label">业主联系电话：</label>
                        <div class="col-sm-4 layui-input" id="NatPer_Phone"></div>
                    </div>


                    <div class="layui-form-item">
                        <label class="col-sm-2  layui-form-label">业主身份证号：</label>
                        <div class="col-sm-4 layui-input" id="NatPer_IDNumber"></div>
                        <label class="col-sm-2  layui-form-label">所属社区：</label>
                        <div class="col-sm-4 layui-input" id="CommunityName"> </div>
                    </div>


                    <div class="layui-form-item">
                        <label class="col-sm-2  layui-form-label">租赁起始时间：</label>
                        <div class="col-sm-4 layui-input laydate-icon layer-date" id="Lease_StartTime"> </div>
                        <label class="col-sm-2  layui-form-label">租赁结束时间：</label>
                        <div class="col-sm-4 layui-input laydate-icon layer-date" id="Lease_EndTime"></div>
                    </div>


                    <div class="layui-form-item" id="TaxEndTime">
                        <label class="col-sm-2  layui-form-label">税收起始时间：</label>
                        <div class="col-sm-4 layui-input laydate-icon layer-date" id="Acceptance_TaxStartTime"></div>
                        <label class="col-sm-2  layui-form-label">税收结束时间：</label>
                        <div class="col-sm-4 layui-input laydate-icon layer-date" id="Acceptance_TaxEndTime"></div>
                    </div>

                    <div class="layui-form-item" id="TaxEndTime">
                        <label class="col-sm-2  layui-form-label">税号：</label>
                        <div class="col-sm-4 layui-input" id="Acceptance_TaxNumber"> </div>
                        <label class="col-sm-2  layui-form-label">付款人/单位：</label>
                        <div class="col-sm-4 layui-input" id="Tenant_Name"></div>
                    </div>

                    <div class="layui-form-item">
                        <label class="col-sm-2  layui-form-label">房屋面积(㎡)：</label>
                        <div class="col-sm-2   layui-input" id="Hs_Proportion"> </div>
                        <label class="col-sm-2  layui-form-label">初始租金（元）：</label>
                        <div class="col-sm-2  layui-input" id="Lease_Rent"></div>
                        <label class="col-sm-2  layui-form-label">计税总额：</label>
                        <div class="col-sm-2 layui-input" id="Evaluate_TotalTax"></div>
                    </div>

                    <div class="layui-form-item">
                        <label class="col-sm-2  layui-form-label">
                            <nobr>产权属性：</nobr>
                        </label>
                        <div class="col-sm-4">
                            <select name="temp" class="form-control" id="Hs_Cqsx" disabled>
                                <option value="1">个人</option>
                                <option value="2">公用</option>
                            </select>
                        </div>
                        <label class="col-sm-2  layui-form-label">
                            <nobr>房屋属性：</nobr>
                        </label>
                        <div class="col-sm-4">
                            <select name="temp" class="form-control" id="Hs_attribute" disabled>
                                <option value="1">住宅</option>
                                <option value="2">非住宅</option>
                            </select>
                        </div>
                    </div>


                    <div class="layui-form-item">
                        <label class="col-sm-2  layui-form-label">评议租金：</label>
                        <div class="col-sm-2 layui-input" id="Review_Rent"> </div>
                        <label class="col-sm-2  layui-form-label">评议人：</label>
                        <div class="col-sm-2 layui-input" id="ReviewUser"> </div>
                        <label class="col-sm-2  layui-form-label">评议时间：</label>
                        <div class="col-sm-2 layui-input" id="Review_Date"></div>
                    </div>

                    <div class="layui-form-item">
                        <label class="col-sm-2  layui-form-label">房产税：</label>
                        <div class="col-sm-2 layui-input" id="Evaluate_PropertyTax"> </div>
                        <label class="col-sm-2  layui-form-label">个人所得税：</label>
                        <div class="col-sm-2 layui-input" id="Evaluate_PersonalTax"></div>
                        <label class="col-sm-2  layui-form-label">税金：</label>
                        <div class="col-sm-2 layui-input" id="Evaluate_Tax"></div>
                    </div>

                    <div class="layui-form-item">
                        <label class="col-sm-2  layui-form-label">评议意见：</label>
                        <div class="col-sm-10 layui-input" id="Review_Comment"> </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="col-sm-2  layui-form-label">评定租金：</label>
                        <div class="col-sm-2 layui-input" id="Evaluate_Rent"> </div>
                        <label class="col-sm-2  layui-form-label">评定人：</label>
                        <div class="col-sm-2 layui-input" id="EvaluateUser"> </div>
                        <label class="col-sm-2  layui-form-label">评定时间：</label>
                        <div class="col-sm-2 layui-input" id="Evaluate_Date"></div>
                    </div>

                    <div class="layui-form-item">
                        <label class="col-sm-2  layui-form-label">评定意见：</label>
                        <div class="col-sm-10 layui-input" id="Evaluate_Comment"> </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="col-sm-2  layui-form-label">审核人：</label>
                        <div class="col-sm-4 layui-input" id="ExamineUser"></div>
                        <label class="col-sm-2  layui-form-label">审核时间：</label>
                        <div class="col-sm-4 layui-input" id="Examine_Date"> </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="col-sm-2  layui-form-label">审核意见：</label>
                        <div class="col-sm-10 layui-input" id="Examine_Comment"></div>
                    </div>

                    <div class="layui-form-item">
                        <label class="col-sm-2  layui-form-label">应收税款：</label>
                        <div class="col-sm-2 layui-input" id="Pt_ActualTax"> </div>
                        <label class="col-sm-2  layui-form-label">操作人：</label>
                        <div class="col-sm-2  layui-input" id="PtUser"> </div>
                        <label class="col-sm-2  layui-form-label">操作时间：</label>
                        <div class="col-sm-2 layui-input" id="Pt_Date"> </div>
                    </div>
                </form>

            </div>
        </div>

</body>
</html>



<script>


    /**
   *   日期选择器---查询租赁日期
   */
    laydate.skin('molv');         //日历皮肤
    var startS = {                   //开始时间选择
        elem: "#Search_StartTime",
        format: "YYYY/MM/DD",
        min: '1900-01-01',
        max: "2099-06-16",
        istime: false,
        istoday: true,
        choose: function (datas) {
            end.min = datas;
            end.start = datas
        }
    };
    var endS = {                     //结束时间选择
        elem: "#Search_EndTime",
        format: "YYYY/MM/DD",
        min: '1900-01-01',
        max: "2099-06-16",
        istime: false,
        istoday: true,
        choose: function (datas) { start.max = datas }
    };
    laydate(startS);
    laydate(endS);

    /**
* 获取上级部门名称
*/
    function GetDtName() {
        var html = "";
        getAjax("/Base/GetDtName_Up", "", function (data) {
            accordionJson = eval("(" + data + ")");
            $.each(accordionJson, function (i) {
                html += "西安市莲湖区地方税务局" + accordionJson[i].Dt_Name
                $("#Dt_Name").html(html);
            });
        });
    }

    /*
     * 打印
     */
    $(function () {
        $("#btnPrint").click(function () {
            var Pt_State = getTableCell(42);
            var Pt_Id = CheckboxValueIDs(); //获取单选按钮的值
            if (Pt_Id.length == 0) {
                layer.msg("请选择要打印的信息！");                                                             //未选中任何行
                return;
            }
            if (Pt_Id.length > 1) {
                layer.msg("只能选择一条信息");                                                             //未选中任何行
                return;
            }

            if (Pt_State == 1) {
                var Pt_CertificateNumber = getTableCell(8);
                layer.confirm("请核对完税证号，确认是否打印? <p align='center' class='Pt_Cer'>" + Pt_CertificateNumber + "</p> ", { icon: 3, btn: ['确定', '取消'] }, function () {
                    GetPrintArea(Pt_Id);
                    document.body.innerHTML = document.getElementById('modalPrint').innerHTML;//填充打印区域
                    window.print();//打印
                    Replace();//刷新
                })
            } else {
                layer.msg("请缴完税款后再打印！");
                return;
            }
        })
    })
    /**
       *打印取值
       */
    function GetPrintArea(Pt_Id) {
        GetDtName();
        var html = "";
        //$("#TenantType").html(getTableCell(46));  //租户类别
        $("#TenantType").html("个人");
        $("#Now_Year").html(getTableCell(41));    //当前时间
        $("#Now_Month").html(getTableCell(47));   //当前时间
        $("#Now_Day").html(getTableCell(48)); //当前时间
        var Tenant_Type = getTableCell(45); //租户类别
 
        $("#NatPer_IDNumber1").html(getTableCell(15));  //个人：身份证号

        
        $("#NatPer_Name").html(getTableCell(4));  //纳税人
        $("#Acceptance_Address1").html(getTableCell(20)); //地址
        $("#ETotalTax1").html(parseFloat(getTableCell(31)).toFixed(2));  //31评定计税总额
        $("#Lease_StartTime1").html(getTableCell(22));
        $("#Lease_EndTime1").html(getTableCell(23));
        $("#lastMonthStart").html(getTableCell(43));
        $("#lastMonthEnd").html(getTableCell(44));
        $("#PtActualTax1").html(getTableCell(40));  //40实缴税金
        $("#User_RealName1").html(getTableCell(11)); //11开票人
        $("#Pt_CertificateNumber1").html(getTableCell(8));//备注：完税证号
        $("#ReviewRent1").html(getTableCell(42));//42评议租金
        $("#AHA1").html(getTableCell(43));//房屋属性
        $("#Hs_attribute1").html(getTableCell(26));//房屋属性
        $("#EPropertyTax").html(getTableCell(29));//29评定房税
        $("#EPersonalTax").html(getTableCell(30));//30评定个税
        var Lease_StartTime = getTableCell(22);
        var Lease_EndTime = getTableCell(23);
        var EReviewRent = getTableCell(7);//租金
        var Hs_attribute = getTableCell(26);
        var fcRat_s = "";
        var grRat_s = "";
        var taxCate = "";  //税种
        var itemsName = "";//品目
        var taxRate = "";  //税率
        var taxCate_g = "";  //税种
        var itemsName_g = "";//品目
        var taxRate_g = "";  //税率
        var ETotalTax2 = "";
        var lastMonthStart2 = "";
        var lastMonthEnd2 = "";
        var EPersonalTax = "";
        if (Hs_attribute == 1) { //住宅
            if (EReviewRent >= 0 && EReviewRent <= 20000) {
                taxCate = "房产税";
                itemsName = "个人出租住房";
                taxRate = "0.04";
            }
            if (EReviewRent > 20000 && EReviewRent <= 31500) {
                taxCate = "房产税";
                itemsName = "个人出租住房";
                taxRate = "0.04";
                taxCate_g = "个人所得税";
                itemsName_g = "个人出租住房所得";
                taxRate_g = "0.08";
                ETotalTax2 = getTableCell(31);  //31评定计税总额
                lastMonthStart2 = getTableCell(43);
                lastMonthEnd2 = getTableCell(44);
                EPersonalTax = getTableCell(30);
            }
        }
        if (Hs_attribute == 2) { //非住宅
            if (EReviewRent >= 0 && EReviewRent <= 20000) {
                taxCate = "房产税";
                itemsName = "从租计征";
                taxRate = "0.12";
            }

            if (EReviewRent > 20000 && EReviewRent <= 31500) {
                taxCate = "房产税";
                itemsName = "从租计征";
                taxRate = "0.12";
                taxCate_g = "个人所得税";
                itemsName_g = "个体工商所得";
                taxRate_g = "0.01";
                ETotalTax2 = getTableCell(31);  //31评定计税总额
                lastMonthStart2 = getTableCell(43);
                lastMonthEnd2 = getTableCell(44);
                EPersonalTax = getTableCell(30);
            }
        }
        $("#taxCate").html(taxCate);
        $("#itemsName").html(itemsName);
        $("#taxRate").html(taxRate);
        $("#taxCate_g").html(taxCate_g);
        $("#itemsName_g").html(itemsName_g);
        $("#taxRate_g").html(taxRate_g);
        if (ETotalTax2 == "" && EPersonalTax == "") {
            $("#ETotalTax2").html(ETotalTax2);//如果为空不显示
            $("#EPersonalTax").html(EPersonalTax);//如果为空不显示
            PtActualTax3 = getTableCell(9); //如果为空金额合计（大写）不显示
        } else {
            $("#ETotalTax2").html(getTableCell(31));//显示
            $("#EPersonalTax").html(getTableCell(30));//显示
            PtActualTax3 = getTableCell(9);//如果不为空金额合计（大写） 显示
            $("#arrive").html("至");
        }
        $("#arrive_s").html("至");
        $("#lastMonthStart2").html(lastMonthStart2);
        $("#lastMonthEnd2").html(lastMonthEnd2);
        $("#PtActualTax3").html(convertCurrency(PtActualTax3));
    }

    /** 数字金额大写转换(可以处理整数,小数,负数) */
    function convertCurrency(money) {
        //汉字的数字
        var cnNums = new Array('零', '壹', '贰', '叁', '肆', '伍', '陆', '柒', '捌', '玖');
        //基本单位
        var cnIntRadice = new Array('', '拾', '佰', '仟');
        //对应整数部分扩展单位
        var cnIntUnits = new Array('', '万', '亿', '兆');
        //对应小数部分单位
        var cnDecUnits = new Array('角', '分', '毫', '厘');
        //整数金额时后面跟的字符
        var cnInteger = '整';
        //整型完以后的单位
        var cnIntLast = '元';
        //最大处理的数字
        var maxNum = 999999999999999.9999;
        //金额整数部分
        var integerNum;
        //金额小数部分
        var decimalNum;
        //输出的中文金额字符串
        var chineseStr = '';
        //分离金额后用的数组，预定义
        var parts;
        if (money == '') { return ''; }
        money = parseFloat(money);
        if (money >= maxNum) {
            //超出最大处理数字
            return '';
        }
        if (money == 0) {
            chineseStr = cnNums[0] + cnIntLast + cnInteger;
            return chineseStr;
        }
        //转换为字符串
        money = money.toString();
        if (money.indexOf('.') == -1) {
            integerNum = money;
            decimalNum = '';
        } else {
            parts = money.split('.');
            integerNum = parts[0];
            decimalNum = parts[1].substr(0, 4);
        }
        //获取整型部分转换
        if (parseInt(integerNum, 10) > 0) {
            var zeroCount = 0;
            var IntLen = integerNum.length;
            for (var i = 0; i < IntLen; i++) {
                var n = integerNum.substr(i, 1);
                var p = IntLen - i - 1;
                var q = p / 4;
                var m = p % 4;
                if (n == '0') {
                    zeroCount++;
                } else {
                    if (zeroCount > 0) {
                        chineseStr += cnNums[0];
                    }
                    //归零
                    zeroCount = 0;
                    chineseStr += cnNums[parseInt(n)] + cnIntRadice[m];
                }
                if (m == 0 && zeroCount < 4) {
                    chineseStr += cnIntUnits[q];
                }
            }
            chineseStr += cnIntLast;
        }
        //小数部分
        if (decimalNum != '') {
            var decLen = decimalNum.length;
            for (var i = 0; i < decLen; i++) {
                var n = decimalNum.substr(i, 1);
                if (n != '0') {
                    chineseStr += cnNums[Number(n)] + cnDecUnits[i];
                }
            }
        }
        if (chineseStr == '') {
            chineseStr += cnNums[0] + cnIntLast + cnInteger;
        } else if (decimalNum == '') {
            chineseStr += cnInteger;
        }
        return chineseStr;
    }


    /** 刷新**/
    $(function () {
        $("#btnRefresh").click(function () {
            Replace();
        })
    })
    /*查询*/

    $("#btnSearchFull").click(function () {
        LayerOpen('800px', '350px', '查询', $('#myModalSearch'));
    });

    /** 缴税 */

    $(function () {
        $("#btnPayTaxes").click(function () {
            var acceptance_Id = getTableCell(13);
            var ptstate = getTableCell(12);
            var actualtax = getTableCell(9) * 100;
            var pt_Id = getTableCell(0);
            var checkId = CheckboxValueIDs();
            if (checkId.length == 0) {
                layer.msg("请选择要缴税的信息！");                                                             //未选中任何行
                return;
            }
            if (checkId.length > 1) {
                layer.msg("只能选择一条要缴税的信息！");                                                        //未选中任何行
                return;
            }
            if (ptstate != "未缴税" && ptstate != null && ptstate != "") {
                layer.msg("已缴税，不能重复缴税！");
                return;
            }
            else {

                layer.confirm("确定要缴税吗?", { icon: 6, btn: ['确定', '取消'] }, function () {
                    ZorPostSimpleData("/Base/AddPayTaxes", JSON.stringify({ 'pt_Id': pt_Id, 'acceptance_Id': acceptance_Id, 'actualtax': actualtax }), function (data) { //获取数据(带参数)
                        layer.msg(data.AnswerMeg, function () {
                            layer.closeAll();
                            Replace();
                        });
                    })
                })
            }
        });
    })
    /** 缴税详情 */
    $(function () {
        $("#btnMessage").click(function () {
            var checkId = CheckboxValueIDs();
            if (checkId.length == 0) {
                layer.msg("请选择要查看缴税的信息！");
                return;
            }
            if (checkId.length > 1) {
                layer.msg("仅可选择一行查看的缴税信息！");
                return;
            }

            $("#Acceptance_TicketNumber").html(getTableCell(2));
            $("#Tenant_Name").html(getTableCell(3));
            $("#NatPerName").html(getTableCell(4));
            $("#NatPer_Phone").html(getTableCell(5));
            $("#Hs_Proportion").html(getTableCell(6));
            $("#Evaluate_Rent").html(getTableCell(7));
            $("#Evaluate_Tax").html(getTableCell(9));
            $("#Pt_Date").html(getTableCell(10));
            $("#PtUser").html(getTableCell(11));
            $("#Acceptance_Id").html(getTableCell(13));
            $("#CommunityName").html(getTableCell(14));
            $("#NatPer_IDNumber").html(getTableCell(15));
            $("#Acceptance_TaxNumber").html(getTableCell(16));
            $("#Review_Rent").html(getTableCell(17));
            $("#Acceptance_Address").html(getTableCell(20));
            $("#Review_Date").html(getTableCell(21));
            $("#Lease_StartTime").html(getTableCell(22));
            $("#Lease_EndTime").html(getTableCell(23));
            $("#Acceptance_TaxStartTime").html(getTableCell(24));
            $("#Acceptance_TaxEndTime").html(getTableCell(25));
            $("#Hs_attribute").val(getTableCell(26));
            $("#Hs_Cqsx").val(getTableCell(27));
            $("#Lease_Rent").html(getTableCell(28));
            $("#Evaluate_PropertyTax").html(getTableCell(29));
            $("#Evaluate_PersonalTax").html(getTableCell(30));
            $("#Evaluate_TotalTax").html(getTableCell(31));
            $("#Review_Comment").html(getTableCell(32));
            $("#ReviewUser").html(getTableCell(33));
            $("#Evaluate_Date").html(getTableCell(34));
            $("#Evaluate_Comment").html(getTableCell(35));
            $("#Examine_Comment").html(getTableCell(36));
            $("#EvaluateUser").html(getTableCell(37));
            $("#Examine_Date").html(getTableCell(38));
            $("#ExamineUser").html(getTableCell(39));
            $("#Pt_ActualTax").html(getTableCell(40));
            LayerOpen('900px', '650px', '缴税详情', $('#myModalDetails'));
        })

    })
</script>

